/* Global scrolling behavior */
html, body {
  overflow-x: hidden;
}

/* Container */
.upload-container {
  padding: 1rem;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
}

/* Card Base */
.upload-card {
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border-secondary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: var(--transition-medium);
  box-shadow: var(--shadow-sm);
}

.upload-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border);
}

/* Compact cards styling */
.actions-card,
.settings-card {
  border-radius: var(--radius-lg);
}

.actions-card .card-header,
.settings-card .card-header {
  padding: 0.875rem 1.25rem;
}

/* Header Card */
.header-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border-secondary);
  flex-wrap: wrap;
  gap: 1rem;
}

.provider-section {
  flex: 1;
}

.provider-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
  width: auto;
  min-width: 200px;
  flex-shrink: 0;
}

.provider-button:hover {
  background: var(--color-surface);
  border-color: var(--color-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.provider-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
}

.provider-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.provider-config {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.2;
}

.provider-arrow {
  color: var(--color-text-secondary);
  transition: var(--transition-fast);
}

.provider-button:hover .provider-arrow {
  color: var(--color-accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.action-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.action-button:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.action-button.secondary {
  background: var(--color-surface-elevated);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.action-button.secondary:hover {
  background: var(--color-surface);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Main Upload Card */
.main-card {
  min-height: 300px;
}

.upload-zone {
  position: relative;
  padding: 3rem 2rem;
  cursor: pointer;
  transition: var(--transition-medium);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-background-secondary) 100%);
  margin: 1rem;
}

.upload-zone:hover,
.upload-zone.drag-active {
  border-color: var(--color-accent);
  background: linear-gradient(135deg, var(--color-surface-elevated) 0%, rgba(0, 122, 255, 0.05) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.upload-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent) 0%, rgba(0, 122, 255, 0.8) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: var(--transition-medium);
}

.upload-text {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.upload-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
  letter-spacing: -0.025em;
}

.upload-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0;
}

.upload-formats {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.format-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Progress */
.progress-container {
  margin: 1rem 1.5rem;
  padding: 1rem;
  background: var(--color-surface-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-secondary);
}

.progress-bar {
  height: 6px;
  background: var(--color-border-secondary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-primary) 100%);
  border-radius: 3px;
  transition: width var(--transition-medium);
}

.progress-fill.progress-error {
  background: var(--color-danger);
}

.progress-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: center;
  display: block;
}

/* Quick Actions Card */
.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border-secondary);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
  letter-spacing: -0.025em;
}

.quick-actions {
  padding: 1rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.quick-action-button {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-medium);
  font-family: inherit;
  text-align: left;
}

.quick-action-button:hover {
  background: var(--color-surface);
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-action-button span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

/* Settings Card */
.settings-content {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .settings-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
  }

  .quick-actions {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (min-width: 1024px) {
  .upload-container {
    padding: 1.5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
  }

  .quick-actions {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .settings-content {
    gap: 2rem;
  }
}

.setting-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  margin: 0;
}

.format-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 0.4rem;
}

.format-button {
  padding: 0.4rem 0.75rem;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.format-button:hover {
  border-color: var(--color-accent);
  color: var(--color-text-primary);
}

.format-button.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.url-toggle {
  display: flex;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  width: 100%;
}

.toggle-button {
  flex: 1;
  padding: 0.625rem 0.875rem;
  background: transparent;
  border: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.toggle-button:hover {
  color: var(--color-text-primary);
}

.toggle-button.active {
  background: var(--color-accent);
  color: white;
}

.toggle-button:first-child.active {
  border-top-left-radius: calc(var(--radius-md) - 1px);
  border-bottom-left-radius: calc(var(--radius-md) - 1px);
}

.toggle-button:last-child.active {
  border-top-right-radius: calc(var(--radius-md) - 1px);
  border-bottom-right-radius: calc(var(--radius-md) - 1px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
}

.modal-container {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xl);
  max-width: 90vw;
  width: 80vw;
  height: 80vh;
  max-height: 90vh;
  overflow: hidden;
  margin: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--color-border-secondary);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.modal-close:hover {
  background: var(--color-surface);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.modal-content {
  padding: 0.2rem;
  overflow-y: auto;
  max-height: calc(90vh - 120px);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal-content::-webkit-scrollbar {
  display: none;
}

/* Transitions */
.progress-enter-active,
.progress-leave-active {
  transition: all var(--transition-medium);
}

.progress-enter-from,
.progress-leave-to {
  opacity: 0;
  transform: translateY(-10px);
}


/* Responsive Design */
@media (max-width: 768px) {
  .upload-container {
    padding: 0.75rem;
    gap: 1rem;
  }

  .header-card .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .provider-section {
    order: 1;
  }

  .header-actions {
    order: 2;
    justify-content: stretch;
  }

  .action-button {
    flex: 1;
    justify-content: center;
  }

  .upload-zone {
    padding: 2rem 1rem;
    margin: 0.75rem;
  }

  .upload-icon {
    width: 60px;
    height: 60px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
    padding: 0.875rem 1rem;
  }

  .settings-content {
    grid-template-columns: 1fr !important;
    padding: 1rem 1.25rem;
  }

  .format-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  }

  .modal-overlay {
    padding: 1rem;
  }

  .modal-header,
  .modal-content {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .upload-container {
    padding: 0.5rem;
  }

  .upload-zone {
    margin: 0.5rem;
    padding: 1.5rem 1rem;
  }

  .upload-title {
    font-size: 1.125rem;
  }

  .quick-action-button {
    padding: 0.75rem 0.875rem;
  }

  .action-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .provider-button {
    min-width: unset;
    width: 100%;
  }
}

/* Dark mode adjustments */
:root.dark .upload-zone,
:root.auto.dark .upload-zone {
  background: linear-gradient(135deg, var(--color-background-secondary) 0%, var(--color-background-tertiary) 100%);
}

:root.dark .upload-zone:hover,
:root.dark .upload-zone.drag-active,
:root.auto.dark .upload-zone:hover,
:root.auto.dark .upload-zone.drag-active {
  background: linear-gradient(135deg, var(--color-surface) 0%, rgba(0, 122, 255, 0.1) 100%);
}

/* Animation for upload icon */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.upload-zone.drag-active .upload-icon {
  animation: float 1.5s ease-in-out infinite;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
.provider-button:focus-visible,
.action-button:focus-visible,
.quick-action-button:focus-visible,
.format-button:focus-visible,
.toggle-button:focus-visible,
.modal-close:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.upload-zone:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}